home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
AMIGA
/
AMICUS
/
AMICUS03.ADF
/
Xref
/
type.c
< prev
next >
Wrap
Text File
|
1986-04-02
|
2KB
|
111 lines
/**************************************************************************
NAME
type -- return type of character: letter or digit
SYNOPSIS
t = type(c);
int t; returned as LETTER or DIGIT or character itself
int c; input character
CAUTIONS
'LETTER' and 'DIGIT' must be equally defined in calling routines.
The value of LETTER must be from a-z or A-Z and the value of DIGIT 0-9.
AUTHOR Philip T. Ansteth
DATE Dec. 6, 1985
CLIENT ANSTETH RESEARCH
**************************************************************************/
#define LETTER 'a'
#define DIGIT '0'
type(c) /* return type of ASCII character */
int c;
{
/* if(c >= 'a' && c <='z' || c >= 'A' && c <= 'Z')
if(isalpha(c))
return(LETTER);
else if (c >= '0' && c <= '9')
else if(isdigit(c))
return(DIGIT);
else
return(c); */
switch(c) {
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o':
case 'p':
case 'q':
case 'r':
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z':
case 'A':
case 'B':
case 'C':
case 'D':
case 'E':
case 'F':
case 'G':
case 'H':
case 'I':
case 'J':
case 'K':
case 'L':
case 'M':
case 'N':
case 'O':
case 'P':
case 'Q':
case 'R':
case 'S':
case 'T':
case 'U':
case 'V':
case 'W':
case 'X':
case 'Y':
case 'Z':
return(LETTER);
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
return(DIGIT);
break;
default:
return(c);
}
}